package main.java.LeetCode.ClassicalAlgorithm.Exp.Impl;

public class QuickOperation {
    public int pow(int num,int index){
        int res = 1;
        while (index>0){
            if((index&1)>0){
               res = res*num;
            }
            num = num*num;
            index>>=1;
        }
        return res;
    }
    public int mul(int num1,int num2){
        int sum = 0;
        while (num2>0){
            if((num2&1)>0){
                sum = sum+num1;
            }
            num1 = num1*2;
            num2>>=1;
        }
        return sum;
    }
}
